package com.yanqu.road.server.cmd.activity.deepfishing;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.DeepFishingProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.deepseafishing.DeepFishingModule;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_DEEP_FISHING_GET_BEACH_DATA,desc = "玩家请求赶海最新数据")
public class DeepFishingBeachCombGetDataCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ret = player.getModule(DeepFishingModule.class).getNewestBeachData();
    }

    @Override
    public void sendData(GamePlayer player) {
        if (ret!=0){
            DeepFishingProto.deepFishingBeachCombGetNewestBeachCombDataRespMsg.Builder builder = DeepFishingProto.deepFishingBeachCombGetNewestBeachCombDataRespMsg.newBuilder();
            builder.setRet(ret);
            player.sendPacket(ClientProtocol.U_DEEP_FISHING_GET_BEACH_DATA,builder);
        }
    }
}
